
import ajax from './index'

export function next_no(type) {
  return ajax({
    url: "/backend/generate/id/" + type,
    method: "get"
  });
}

export function fetchUploadGroup(mediaType) {
  return ajax({
    url: '/pms/file/group/' + mediaType,
    method: 'get'
  });
}

export function uploadSubmit(data) {
  return ajax({
    url: '/pms/files/upload',
    method: 'post',
    data
  });
}

export function getUploadList(query) {
  return ajax({
    url: '/pms/files/image',
    method: 'get',
    params: query
  });
}

export function getUploadToken(groupCode) {
  return ajax({
    url: '/pms/files/upload_token/image/' + groupCode,
    method: 'get'
  });
}


export function createFileGroup(data) {
  return ajax({
    url: '/pms/file/group/create',
    method: 'post',
    data: data
  });
}

export function editFileGroup(data) {
  return ajax({
    url: '/pms/file/group/update/' + data.id,
    method: 'post',
    data: data
  });
}

export function deleteFileGroup(id) {
  return ajax({
    url: '/pms/file/group/delete/' + id,
    method: 'post',
  });
}

export function deleteFile(id) {
  return ajax({
    url: '/pms/files/delete/' + id,
    method: 'post',
  });
}
